package com.jar.exercise.反射.任务2;

import org.junit.Assert;

import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * 1)自定义一个有效的Annotation注释名为MyAnnotation，
 * 其中有属性myname创建Student类并重写toString()，toString()要求使用三个基本的Annotation和自定义的MyAnnotation注释
 * 2)创建TestGetAnno类，打印出Student类的toString方法的所有注释
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Class<Student> studentClass = Student.class;
        Type genericSuperclass = studentClass.getGenericSuperclass();
        System.out.println(studentClass.getName());
        System.out.println(studentClass.getTypeName());
    }
}

@MyAnnotation
class Student extends People {
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @MyAnnotation("child")
    void say() {

    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                '}';
    }
}

class People {

    @MyAnnotation("father")
    void say() {
    }
}